<?php

namespace App\Models\WorkOrder\ProductSelectionProposal;

use App\Models\BaseModel;
use App\Models\Traits\KfSoftDeletes;
use App\Models\Traits\KfUid;
use App\Models\WorkOrder\WorkOrderApplyContentModel;
use Illuminate\Database\Eloquent\Relations\HasOne;

class WorkOrderProductSelectionProposalModel extends BaseModel
{
    use KfSoftDeletes, KfUid;

    protected $table = 'work_order_product_selection_proposal';

    protected $fillable = [
        'id',
        'workOrderNo',
        'shopId',
        'type',
        'status',
        'dealStatus',
        'createdByUid',
        'updatedByUid',
        'createdAt',
        'updatedAt',
        'isDeleted',
    ];

    const TYPE_FRANCHISEE = 1;
    const TYPE_STAFF      = 2;

    const TYPE_TEXT = [
        self::TYPE_FRANCHISEE => '商家app',// 加盟商
        self::TYPE_STAFF      => '飞书',// 员工
    ];

    const ADOPT_STATUS_DEFAULT      = 1;
    const ADOPT_STATUS_NOT_ACCEPTED = 3;
    const ADOPT_STATUS_ACCEPTED     = 2;
    const ADOPT_STATUS_ONLINE       = 4;
    const ADOPT_STATUS_HOT          = 5;

    const ADOPT_STATUS_TEXT   = [
        self::ADOPT_STATUS_DEFAULT      => '评审中',
        self::ADOPT_STATUS_NOT_ACCEPTED => '未采纳',
        self::ADOPT_STATUS_ACCEPTED     => '采纳奖',
        self::ADOPT_STATUS_ONLINE       => '上线奖',
        self::ADOPT_STATUS_HOT          => '爆品奖',
    ];
    const DEAL_STATUS_DEFAULT = 1;
    const DEAL_STATUS_REPLIED = 2;

    const DEAL_STATUS_TEXT = [
        self::DEAL_STATUS_DEFAULT => '未处理',
        self::DEAL_STATUS_REPLIED => '已处理',
    ];


    /**
     * @return HasOne
     */
    public function contentRel(): HasOne
    {
        return $this->hasOne(WorkOrderApplyContentModel::class, 'workOrderNo', 'workOrderNo');
    }
}
